package com.fulihui.systemcore;

import com.alibaba.fastjson.JSON;
import org.junit.Test;
import org.near.toolkit.security.codec.AESCoder;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Created by Willard.Hu on 2016/8/16 0016.
 */
public class AppVersionInfo {

    @Test
    public void test_android() {
        Map<String, Object> conf = new HashMap<>();
        conf.put("upgrade", false);
        conf.put("version", "1.0.0");
        conf.put("download", "http://192.168.4.21:8080/fulihui/app-debug.apk");
        System.out.println(JSON.toJSONString(conf));
    }

    @Test
    public void test_ios() {
        Map<String, Object> conf = new HashMap<>();
        conf.put("upgrade", false);
        conf.put("version", "1.0.0");
        conf.put("download", "");
        System.out.println(JSON.toJSONString(conf));
    }

    public static void main(String[] args) {
        //解密
        String decrypt = AESCoder.decrypt("kjJ+0xAljCbdO4sPsaHSDh5F86oN/ISbApx+nJuVuv8=", "XLL1vKqorA36MnsLhk3eow==");
        System.out.println(decrypt);

        //加密
        String test = AESCoder.encrypt("6jfOI65OVdOkElPx", "XLL1vKqorA36MnsLhk3eow==");
        System.out.println(test);

        String genKey = AESCoder.genKey();
        System.out.println(genKey);

        String is_db = AESCoder.encrypt("Wj+ZycRAWPZ/gHb8kp1WSA==", genKey);
        System.out.println(is_db);

    }
}
